package maze.view;

import maze.app.Maze;

import org.lwjgl.opengl.GL11;

public class SunSprite extends Sprite
{
	public float xx; // the actual position of x (used while moving)
	public float yy; // the actual position of y (used while moving)
	public float dx;
	public float dy;

	public float r;
	public float dr;

	public SunSprite()
	{
		super("sun");

		init();
	}

	@Override
	public void init()
	{
		pos.x = 0;
		pos.y = 0;
		xx = 0;
		yy = 0;
		dx = 0;
		dy = 0;

		r = 0;
		dr = 2.0f;
	}

	@Override
	public void render()
	{
		GL11.glPushMatrix();

		// leave the blank for each side
		GL11.glTranslatef(Maze.BLANK_UNIT, Maze.BLANK_UNIT, 0.0f);

		GL11.glTranslatef((xx + 0.5f) * Maze.UNIT, (yy + 0.5f) * Maze.UNIT, 0.0f);
		GL11.glRotatef(r, 0, 0, 1);

		drawTexture();

		GL11.glPopMatrix();

		xx += dx;
		yy += dy;
		r = (r + dr) % 360;
	}
}
